get analytics user created
Retrieve daily user creation statistics from TabNews to analyze platform growth trends and user acquisition patterns.
Instructions
To get how many users were created (per day) in tabnews
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/status.ts:193-214 (handler)The handler function for the MCP tool 'get analytics user created'. It calls the getAnalyticsUserCreated service function, formats the result as MCP text content with JSON, and handles errors.handler: async (): Promise<McpResponse> => { try { const result = await getAnalyticsUserCreated(); const content: McpTextContent = { type: "text", text: `Analytics User Created:\n\n${JSON.stringify(result, null, 2)}`, }; return { content: [content], }; } catch (error) { if (error instanceof Error) { throw new Error( `Failed to get analytics user created: ${error.message}` ); } else { throw new Error("Failed to get analytics user created"); } } },
- src/index.ts:59-64 (registration)Registers the 'get analytics user created' tool with the MCP server by providing its name, description, parameters schema, and handler function.server.tool( getAnalyticsUserCreatedTool.name, getAnalyticsUserCreatedTool.description, getAnalyticsUserCreatedTool.parameters, getAnalyticsUserCreatedTool.handler );
- src/services/api.ts:83-90 (helper)Core service function that fetches the analytics data for users created from the TabNews API endpoint '/analytics/users-created'.export async function getAnalyticsUserCreated(): Promise< AnalyticsUserCreated[] > { const response = await fetch(`${TABNEWS_API_URL}/analytics/users-created`); const data = await response.json(); return data as AnalyticsUserCreated[]; }
- src/types/index.ts:120-123 (schema)TypeScript interface defining the structure of the analytics data returned by the tool (array of objects with date and number of user registrations).export interface AnalyticsUserCreated { date: string; cadastros: number; }